package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreShortMsg;
import com.fujitsu.nanjing.tieba.ibator.CoreShortMsgCriteria;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreShortMsgDAOImpl extends SqlMapClientDaoSupport implements CoreShortMsgDAO {

    public CoreShortMsgDAOImpl() {
        super();
    }

    public int countByExample(CoreShortMsgCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_short_msg.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreShortMsgCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_short_msg.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(Integer msgid) {
        CoreShortMsg _key = new CoreShortMsg();
        _key.setMsgid(msgid);
        int rows = getSqlMapClientTemplate().delete("core_short_msg.deleteByPrimaryKey", _key);
        return rows;
    }

    public void insert(CoreShortMsg record) {
        getSqlMapClientTemplate().insert("core_short_msg.insert", record);
    }

    public void insertSelective(CoreShortMsg record) {
        getSqlMapClientTemplate().insert("core_short_msg.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreShortMsg> selectByExample(CoreShortMsgCriteria example) {
        List<CoreShortMsg> list = getSqlMapClientTemplate().queryForList("core_short_msg.selectByExample", example);
        return list;
    }

    public CoreShortMsg selectByPrimaryKey(Integer msgid) {
        CoreShortMsg _key = new CoreShortMsg();
        _key.setMsgid(msgid);
        CoreShortMsg record = (CoreShortMsg) getSqlMapClientTemplate().queryForObject("core_short_msg.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreShortMsg record, CoreShortMsgCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_short_msg.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(CoreShortMsg record, CoreShortMsgCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_short_msg.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreShortMsg record) {
        int rows = getSqlMapClientTemplate().update("core_short_msg.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreShortMsg record) {
        int rows = getSqlMapClientTemplate().update("core_short_msg.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreShortMsgCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreShortMsgCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}